<template>
  <div class="project-info">
    <a-descriptions bordered :column="2" size="small" class="col-span-2">
      <a-descriptions-item label="项目编号">
        {{ projectAuditInfo.projectBuild.projectNo }}
      </a-descriptions-item>
      <a-descriptions-item label="项目经理">
        {{ projectAuditInfo.projectManager }}
      </a-descriptions-item>
    </a-descriptions>
    <a-descriptions bordered :column="1" size="small">
      <a-descriptions-item label="项目名称">
        {{ projectAuditInfo.projectBuild.projectName }}
      </a-descriptions-item>
      <a-descriptions-item label="主导经营体">
        {{ projectAuditInfo.projectBuild.mainDeptName }}
      </a-descriptions-item>
      <a-descriptions-item label="费用支出公司">
        {{ projectBudgetFactory }}
      </a-descriptions-item>
      <a-descriptions-item label="关键词">
        {{ projectAuditInfo.projectBuild.keywords }}
      </a-descriptions-item>
      <a-descriptions-item label="项目内容简述">
        {{ projectAuditInfo.projectBuild.projectContent }}
      </a-descriptions-item>
      <a-descriptions-item label="是否需要工程动议">
        {{ initContent() }}
      </a-descriptions-item>
      <a-descriptions-item label="设计开发来源">
        {{ initSource() }}
      </a-descriptions-item>
      <a-descriptions-item label="来源于以前类似设计和开发活动的信息">
        {{ projectAuditInfo.projectBuild.sourceBefore }}
      </a-descriptions-item>
    </a-descriptions>
  </div>
</template>

<script>
import { getAction, postAction } from '@/api/manage'
import { getParamValFromUrl, caseToShow } from '@/utils/common.js'
export default {
  name: 'ProjectBuildBasicT',
  components: {},
  data() {
    return {
      designSourceOptions: [],
      requrl: {
        codeInfoList: '/manage/codeInfo/list',
      },
      sourceDesign: [],
      highTechTypeName: '',
      projectBudgetFactory:''
    }
  },
  mounted() {
    this.initSourceDesign()
  },
  props: {
    projectAuditInfo: {
      Type: Object,
      default: '',
    },
  },
  methods: {
    initContent() {
      if (this.projectAuditInfo.projectBuild.isNeedEngineeringMotion) {
        return '是，项目名称或编号：' + this.projectAuditInfo.projectBuild.motionProjectNameOrNo
      } else {
        return '否'
      }
    },
    initSource() {
      let designText = []
      this.designSourceOptions.forEach((item) => {
        if (this.sourceDesign.indexOf(item.value) > -1) {
          designText.push(item.label)
        }
      })
      return designText.length == 0 ? '' : designText.join(',')
    },
    initSourceDesign() {
      var vm = this
      getAction(vm.requrl.codeInfoList, { type: '项目立项设计来源' }).then((res) => {
        if (res.code == 200) {
          res.result.records.forEach((element) => {
            vm.designSourceOptions.push({
              label: element.name,
              value: element.code,
              disabled: true,
            })
          })
          var ds = vm.projectAuditInfo.projectBuild.designSource
          if (ds != null) {
            vm.sourceDesign = ds.split(',')
          }
        } else {
          this.$message.warning('加载【项目立项设计来源】选项有误：' + res.message)
        }
      })

      getAction('/projectBuildAudit/getBudgetFactoryById', { id:this.projectAuditInfo.projectBuild.id}).then((res) => {
        if (res.code == 200) {
          this.projectBudgetFactory  = res.result || ''
        }
      })
    },
    caseToShow(obj) {
      return caseToShow(obj)
    },
  },
}
</script>
<style lang="less" scoped>
/deep/.ant-checkbox-disabled + span {
  color: black;
}
.project-info {
  color: black;
  .info-detail {
    background-color: #fff;
    border: 1px solid #ebebeb;
    padding: 1% 2.5%;
    margin-bottom: 15px;
    position: relative;
    font-size: 16px;
    > span {
      display: inline-block;
      margin-left: 15px;
    }
    .list-title {
      font-weight: 900;
      height: unset;
      line-height: 28px;
    }
    .row-content {
      display: flex;
      align-items: baseline;
      > span {
        white-space: normal;
      }
    }
    .info-list {
      padding: unset;
      display: flex;
      flex-wrap: wrap;
      margin-bottom: 0;
      > li {
        width: 33.33%;
        padding: 3px 0;
        height: auto;
        display: flex;
        align-items: center;
        // >img{
        //   margin-right: 5px;
        // }
        .comment {
          white-space: pre-wrap;
        }
        span {
          // line-height: 1.2;
        }
      }
      .left {
        display: flex;
        align-items: baseline;
      }
      .one-row {
        width: 100%;
        align-items: baseline;
        height: auto;
        padding: 3px 0px;
        > span {
          width: calc(100% - 170px);
        }
      }
    }
    .info-content {
      .content-title {
        display: flex;
        align-items: center;
        font-weight: 900;
        img {
          margin-right: 5px;
        }
      }
      .content-box {
        padding: 5px 16px 0;
      }
    }
  }
}
</style>